/*
 * @Author       : Hejh(3010733382@qq.com)
 * @Version      : V1.0
 * @Date         : 2024-01-30 11:01:15
 * @Description  : 激活码相关接口
 */

import type {
  ActiveCodeCreateReq,
  ActiveCodePageRes,
  ActiveCodeReq,
  ActiveCodeUpdateReq
} from '@/types/activeCode'
import request from '@/utils/request'

// 分页查询激活码接口
export const getActiveCodeByPage = (params?: ActiveCodeReq) => {
  return request.get<ActiveCodePageRes>('/activeCode/list', { params })
}

// 分页查询激活码接口
export const getAuthActiveCodeByPage = (params?: ActiveCodeReq) => {
  return request.get<ActiveCodePageRes>('/activeCode/auth/list', { params })
}

// 添加激活码接口
export const createActiveCode = (data: ActiveCodeCreateReq) => {
  return request.post('/activeCode/create', data)
}

// 更新激活码接口
export const updateActiveCode = (data: ActiveCodeUpdateReq) => {
  return request.put('/activeCode/update', data)
}

// 激活码排序接口
export const sortActiveCode = (activeCodeIds: string[]) => {
  return request.put('/activeCode/sort', { activeCodeIds })
}

// 激活码删除接口
export const delActiveCode = (activeCodeIds: string[], picCode?: string) => {
  return request.delete('/activeCode/delete', { data: { activeCodeIds, picCode } })
}
